//--------------------------------------------------------------------------------------
// register the function
var newRegistery1 = new Array("getMarketView", "drawMarketViewPieChart" );
allJsonsRegistry = allJsonsRegistry.concat(newRegistery1);

//--------------------------------------------------------------------------------------
// implement the function
// final function that builds the chart from the json object
function drawMarketViewPieChart(marketViewDictionary) 
{
	var repdata = new google.visualization.DataTable();
	repdata.addColumn('string', 'Asset');
	repdata.addColumn('number', 'Repartition');
	repdata.addRows(marketViewDictionary.viewList.length);
    for (var i = 0; i < marketViewDictionary.viewList.length; i++)
    {
        repdata.setValue(i, 0, marketViewDictionary.viewList[i].assetName );
        repdata.setValue(i, 1, marketViewDictionary.viewList[i].view);
    }

    var repchart = new google.visualization.PieChart(document.getElementById('repartitionMarketChart_div'));
	repchart.draw(repdata, {width: 300, height: 230, title: 'Market Expectations (Click to see values)'});
};
